Parallel branch verification#634
Merged
Merged
Conversation
…les but needs a different way when set internally??
mschwerhoff
approved these changes
Sep 2, 2022
mschwerhoff
left a comment
Contributor
There was a problem hiding this comment.
I totally approve on branch parallelisation 👍 💯 🥇 🚀 💎 But please see my comments nonetheless.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Depends on the Z3 API PR (not because there are real functional dependencies but simply because I merged the two at some point to be able to test both together))
Building on Malte's earlier attempt to get parallel branch verification, this PR adds a command line parameter --parallelizeBranches that directs Silicon to verify different branches in parallel.
We use a ForkJoinPool for this which uses a work stealing algorithm, so every worker has its own Z3 instance and its own work queue. When it reaches a branch, it puts the else-branch into its own queue s.t. other idle workers can take it; if noone does, it will take the else-branch-task from the beginning of its own queue and verify it itself.
Workers that become idle will steal from the end of the queue of another worker and therefore get the oldest task that worker still has left over, which tends to be the biggest task in the queue, which should avoid switching back and forth between workers for tiny tasks.
Every task switch requires updating the worker's solver to the branch's current state, i.e., popping all its current path conditions and pushing all path conditions from the task it's taking over.
Speedups obviously depend on the program and the machine, but if you have a bunch of cores lying around and your program has lots of branching, things will become MUCH faster (e.g. 6x for Nagini VerifyThis examples on my desktop at home).